<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:security="http://www.springframework.org/security/facelets/tags"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>
	<security:isAuthenticated>
		<h:panelGroup
			rendered="#{not empty selectedPortfolioBean.selectedPortfolio}">
			<div class="grid_4">
				<div class="box">
					<h2>
						<h:outputFormat value="#{msg['portfolioStatistics.stats']}">
							<f:param value="#{selectedPortfolioBean.selectedPortfolio.name}" />
						</h:outputFormat>
					</h2>
					<div class="block">
						<table>
							<tbody>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.originalBalance']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.originalBalance}" /></td>
								</tr>
								<tr>
									<th><h:outputText
											value="#{msg['portfolioStatistics.balance']}" /></th>
									<td><h:outputText value="#{selectedPortfolioBean.balance}" /></td>
								</tr>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.portfolioValue']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.portfolioValue}" /></td>
								</tr>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.totalValue']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.portfolioTotalValue}" /></td>
								</tr>
							</tbody>
						</table>

						<table>
							<tbody>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.blockedBalance']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.blockedBalance}" /></td>
								</tr>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.commissionsValue']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.commissionValue}" /></td>
								</tr>
							</tbody>
						</table>

						<table>
							<tbody>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.activeOrders']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.numberOfActiveOrders}" /></td>
								</tr>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.completedOrders']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.numberOfCompletedOrders}" /></td>
								</tr>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.canceledOrders']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.numberOfCanceledOrders}" /></td>
								</tr>
							</tbody>
						</table>

						<table>
							<tbody>
								<tr>
									<td><h:outputText
											value="#{msg['portfolioStatistics.createDate']}" /></td>
									<td><h:outputText
											value="#{selectedPortfolioBean.createdAt}" /></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>

			<div class="grid_8">
				<div class="box">
					<h2>
						<h:outputText value="#{msg['portfolioStatistics.portfolioSplit']}" />
					</h2>
					<div class="block">
						<p:pieChart value="#{selectedPortfolioBean.pieChartModel}"
							title="#{msg['portfolioStatistics.portfolioContent']}"
							sliceMargin="5" legendPosition="se" enhancedLegend="true" />
					</div>
				</div>
			</div>


			<div class="grid_4">
				<div class="box">
					<h2>
						<h:outputText
							value="#{msg['portfolioStatistics.portfolioContent']}" />
						&#160; (
						<h:outputText value="#{selectedPortfolioBean.numberOfCompanies}" />
						)
					</h2>
					<div class="block" style="text-align: center;">
						<h:form id="form">
							<p:dataList value="#{selectedPortfolioBean.portfolioCompanies}"
								var="quot" paginator="true" rows="15" paginatorPosition="top"
								itemType="none" styleClass="dataList"
								emptyMessage="#{msg['prime.noRecordsFound']}"
								paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink}">

								<p:column style="margin-left: 0;">
									<pretty:link mappingId="companyDetails">
										<f:param value="#{quot.company.name}" />
										<h:outputText value="#{quot.company.name}" />
									</pretty:link>
									&#160;»&#160;
									<h:outputText
										styleClass="#{(quot.dailyChange gt 0) ? 'positive_value' : ((quot.dailyChange lt 0) ? 'negative_value' : 'neutral_value') }"
										value="#{quot.dailyChange}" />
									%
								</p:column>
							</p:dataList>
						</h:form>
					</div>
				</div>
			</div>
		</h:panelGroup>
	</security:isAuthenticated>
</ui:composition>

</html>
